package com.aceitunaproject.mapdisplay.model.map;

import java.util.Iterator;
import java.util.NoSuchElementException;

/**
 * Base class for internal iterators.
 */
abstract class MapIterator implements Iterator<Position> {

    protected Direction[] directions = Direction.values();

    /**
     * Get the next position as a position rather as an object.
     * 
     * @return position.
     * @throws NoSuchElementException
     *             if iterator is exhausted.
     */
    public abstract Position nextPosition() throws NoSuchElementException;

    /**
     * Returns the next element in the iteration.
     * 
     * @return the next element in the iteration.
     * @exception NoSuchElementException
     *                iteration has no more elements.
     */
    public Position next() {
        return nextPosition();
    }

    /**
     * Removes from the underlying collection the last element returned by
     * the iterator (optional operation).
     * 
     * @exception UnsupportedOperationException
     *                no matter what.
     */
    public void remove() {
        throw new UnsupportedOperationException();
    }
}